package com.my.study.lock;

import java.util.concurrent.TimeUnit;

public class TestReadWriteLock {
    public static void main(String[] args) throws InterruptedException {
        MyCache cache = new MyCache();
        for (int i = 0; i < 5; i++) {
            int index = i;
            new Thread(()->{
                cache.put("test"+ index,"test"+index);
            },"test"+i).start();
        }
        TimeUnit.SECONDS.sleep(1);
        System.out.println("=================================");
        for (int i = 0; i < 5; i++) {
            int index = i;
            new Thread(()->{
                cache.get("test"+ index);
            },"test"+i).start();
        }
    }
}
